package com.running.base.run.util;

import org.apache.commons.lang3.ArrayUtils;

import java.lang.reflect.Field;

/**
 * Created by Daniel on 14/04/2017.
 */
public class FieldUtil {

    public static Field[] getAllFields(Class<?> clazz) {
        if (clazz == null) {
            return null;
        }
        Field[] declaredFields = clazz.getDeclaredFields();
        Class<?> parent = clazz.getSuperclass();

        return ArrayUtils.addAll(declaredFields, getAllFields(parent));
    }

}
